import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/database/beans/get_token_entity.dart';

GetTokenEntity $GetTokenEntityFromJson(Map<String, dynamic> json) {
  final GetTokenEntity getTokenEntity = GetTokenEntity();
  final String? accessToken = jsonConvert.convert<String>(json['accessToken']);
  if (accessToken != null) {
    getTokenEntity.accessToken = accessToken;
  }
  final int? expiresIn = jsonConvert.convert<int>(json['expiresIn']);
  if (expiresIn != null) {
    getTokenEntity.expiresIn = expiresIn;
  }
  final int? isInitialPassword = jsonConvert.convert<int>(json['isInitialPassword']);
  if (isInitialPassword != null) {
    getTokenEntity.isInitialPassword = isInitialPassword;
  }
  final String? refreshToken = jsonConvert.convert<String>(json['refreshToken']);
  if (refreshToken != null) {
    getTokenEntity.refreshToken = refreshToken;
  }
  final String? tokenType = jsonConvert.convert<String>(json['tokenType']);
  if (tokenType != null) {
    getTokenEntity.tokenType = tokenType;
  }
  return getTokenEntity;
}

Map<String, dynamic> $GetTokenEntityToJson(GetTokenEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['accessToken'] = entity.accessToken;
  data['expiresIn'] = entity.expiresIn;
  data['isInitialPassword'] = entity.isInitialPassword;
  data['refreshToken'] = entity.refreshToken;
  data['tokenType'] = entity.tokenType;
  return data;
}

extension GetTokenEntityExtension on GetTokenEntity {
  GetTokenEntity copyWith({
    String? accessToken,
    int? expiresIn,
    int? isInitialPassword,
    String? refreshToken,
    String? tokenType,
  }) {
    return GetTokenEntity()
      ..accessToken = accessToken ?? this.accessToken
      ..expiresIn = expiresIn ?? this.expiresIn
      ..isInitialPassword = isInitialPassword ?? this.isInitialPassword
      ..refreshToken = refreshToken ?? this.refreshToken
      ..tokenType = tokenType ?? this.tokenType;
  }
}